package com.icez.demo

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.util.Log
import android.widget.TextView
import com.icez.ball_ripple_progress_library.BallRippleProgressView

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val progress = findViewById<BallRippleProgressView>(R.id.progress)
        val progressVaue = findViewById<TextView>(R.id.progressVaue)

        // 进来就设置，自带动画
        progress.setProgress(0.5f)

        // 点击设置,没有动画
        progress.setOnClickListener {
            progress.setProgress(0.8f)
        }

        // 监听
        progress.setOnProgressCallback(object:BallRippleProgressView.OnProgressCallback{
            override fun progress(currentProgress: Float) {
                // 进度显示textview
                progressVaue.text = (currentProgress * 100).toInt().toString() + "%"
            }

        })
    }
}